<template>
  <ant-modal
    modalWidth="576"
    modalHeight="500"
    :visible="open"
    :modal-title="formTitle"
    :adjust-size="true"
    @cancel="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" slot="content" layout="vertical">
      <a-row :gutter="32">
        <a-col :span="12">
          <a-form-model-item label="主机名" prop="hostName">
            <a-input v-model="form.hostName" placeholder="请输入主机名"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="主机IP" prop="hostIp">
            <a-input v-model="form.hostIp" placeholder="请输入主机IP"/>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row :gutter="32">
        <a-col :span="12">
          <a-form-model-item label="主机端口" prop="hostPort">
            <a-input v-model="form.hostPort" placeholder="请输入主机端口"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="主机账号" prop="account">
            <a-input v-model="form.account" placeholder="请输入主机账号"/>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row :gutter="32">
        <a-col :span="12">
          <a-form-model-item label="主机密码" prop="password">
            <a-input v-model="form.password" placeholder="请输入主机密码"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="12" >
          <a-form-model-item label="类型" prop="type">
            <a-select
              placeholder="请选择类型"
              v-model="form.type"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear>
              <a-select-option v-for="(d, index) in typeOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row :gutter="32">
        <a-col :span="12" >
          <a-form-model-item label="状态" prop="status">
            <a-radio-group v-model="form.status">
              <a-radio
                v-for="(dict, index) in statusOptions"
                :key="index"
                :value="dict.dictValue"
              >
                {{ dict.dictLabel }}
              </a-radio>
            </a-radio-group>
          </a-form-model-item>
        </a-col>
        <a-col :span="12">
          <a-form-model-item label="备注" prop="remark">
            <a-textarea v-model="form.remark" placeholder="请输入备注" :rows="4"/>
          </a-form-model-item>
        </a-col>
      </a-row>
      <a-row :gutter="32">
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-button :disabled="disabled" @click="cancel">
        取消
      </a-button>
      <a-button type="primary" :disabled="disabled" @click="submitForm(true)">
        保存
      </a-button>
    </template>
  </ant-modal>
</template>
<script>
import HostAddForm from './HostForm'
export default {
  ...HostAddForm
}
</script>
